<?php
/*******************************************************************************
 *
 *  Controller Name: 
 *
 *  Date: 
 *  
 *  Description: 
 *  
 *  Author: 
 *  
 *  Todo:
 *     NONE
 *
 *  Modification History:  
 * 
 *   Date         Name
 *  ----------   --------------
 *  2012-04-23   HAYDEN WAISANEN
 *  2012-04-09   HAYDEN WAISANEN
 *  2012-04-01   HAYDEN WAISANEN
 * 
 *****************************************************************************/
?>
<?php
class Dbtest extends CI_Controller {

	public function index()
	{
      $this->load->database();
      $query = $this->db->query('SELECT user_data FROM ci_sessions');
      foreach ($query->result_array() as $row)
      {
         //echo $row"<br>";
         var_dump(unserialize($row["user_data"]));
      }
      
      /*$query = $this->db->query('SELECT * FROM test');

      foreach ($query->result() as $row)
      {
         echo $row->myint."<br>";
      }

      echo 'Total Results: ' . $query->num_rows();  
      $this->load->model('User_model','user');
      $this->user->insert( 
         array( 'UserID' => 'George',
               'Email' => 'Hayden.waisanen@mines.sdsmt.edu',
               'Password' => '',
               'IsManager' => 1));
      $results = $this->user->getAllUsers();
      foreach ($results as $row)
      {
         echo $row['UserID']." ";
         echo $row['Email']." ";
         echo $row['IsManager']."<br>";
         $this->user->update($row);
      }
      $this->user->delete(array('UserID'=>'Haydenzoneappendappend'));
      $this->load->model('Customerrep_model','user');
      $this->user->insert(array( 'UserID' => 'Haydenzone' ));
      $results = $this->user->get('Haydenzone');
      echo count($results);
      
      $this->load->model('Analyst_model','analyst');
      $this->analyst->insert(array( 'UserID' => 'Haydenzone' ));
      $this->analyst->insert(array( 'UserID' => 'Hadenzone' ));
      $this->analyst->delete(array( 'UserID' => 'Haydenzone' ));
      $results = $this->analyst->getAll();
      echo count($results);
      $this->load->model('Irteam_model','irteam');
      $this->irteam->insert(array('UserID' => 'Haydenzone1', 'Status' => 1));
      $results = $this->irteam->getAll();
      foreach ($results as $row)
      {
         echo $row['UserID']." ";
         echo $row['Status']."<br>";
         $row['Status'] = 5;
         $this->irteam->update($row);
      }
      $this->load->model('Incident_model','incident');
      //$this->incident->insert(array('UserID' => 'Haydenzone1', 'Status' => 1));
      $results = $this->incident->getAll();
      foreach ($results as $row)
      {
         var_dump($row);
         $row['WorkStarted'] = date( 'Y-m-d H:i:s');
         $this->incident->update($row);
      }
      $this->load->model('Report_model','report');
      $this->report->insert(array('ReportID' => 173, 'ReportTime' => date( 'Y-n-d H:i:s')));
      $results = $this->report->getAll();
      foreach ($results as $row)
      {
         var_dump($row);
         $this->report->update($row);
      }
      */
      

	}
}
?>
